﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Bdcs.Core.Entity
{
    /// <summary>
    /// TP_EventHistory数据模型对象
    /// </summary>
    [Serializable]
    public partial class TP_EventHistoryMod
    {
        /// <summary>
        /// 初始化TP_EventHistory数据模型对象
        /// </summary>
        public TP_EventHistoryMod()
        {
            
        }
        /// <summary>
        /// 初始化TP_EventHistory数据模型对象并给在SQL中不能为空的字段赋值
        /// </summary>
        /// <param name="iD">ID</param>
        /// <param name="eventKey">EventKey</param>
        /// <param name="eventType">EventType</param>
        public TP_EventHistoryMod(long iD,string eventKey,string eventType)
        {
            //给ID字段赋值
            this.ID = iD;
            //给EventKey字段赋值
            this.EventKey = eventKey;
            //给EventType字段赋值
            this.EventType = eventType;
        }
        /// <summary>
        /// 初始化TP_EventHistory数据模型对象并给所有字段赋值
        /// </summary>
        /// <param name="iD">ID</param>
        /// <param name="eventKey">EventKey</param>
        /// <param name="startTime">StartTime</param>
        /// <param name="endTime">EndTime</param>
        /// <param name="carNo">CarNo</param>
        /// <param name="deviceNo">DeviceNo</param>
        /// <param name="evtPara">EvtPara</param>
        /// <param name="eventType">EventType</param>
        /// <param name="mileage">Mileage</param>
        /// <param name="middleTime">MiddleTime</param>
        public TP_EventHistoryMod(long iD,string eventKey,DateTime? startTime,DateTime? endTime,string carNo,string deviceNo,string evtPara,string eventType,decimal? mileage,DateTime? middleTime)
        {
            //给ID字段赋值
            this.ID = iD;
            //给EventKey字段赋值
            this.EventKey = eventKey;
            //给StartTime字段赋值
            this.StartTime = startTime;
            //给EndTime字段赋值
            this.EndTime = endTime;
            //给CarNo字段赋值
            this.CarNo = carNo;
            //给DeviceNo字段赋值
            this.DeviceNo = deviceNo;
            //给EvtPara字段赋值
            this.EvtPara = evtPara;
            //给EventType字段赋值
            this.EventType = eventType;
            //给Mileage字段赋值
            this.Mileage = mileage;
            //给MiddleTime字段赋值
            this.MiddleTime = middleTime;
        }
        
		//属性存储数据的变量
        private long _iD;
        private string _eventKey;
        private DateTime? _startTime;
        private DateTime? _endTime;
        private string _carNo;
        private string _deviceNo;
        private string _evtPara;
        private string _eventType;
        private decimal? _mileage;
        private DateTime? _middleTime;
        
        /// <summary>
        /// ID
        /// </summary>
        public long ID
        {
            get { return this._iD; }
            set { this._iD = value; }
        }
        /// <summary>
        /// EventKey
        /// </summary>
        public string EventKey
        {
            get { return this._eventKey; }
            set { this._eventKey = value; }
        }
        /// <summary>
        /// StartTime
        /// </summary>
        public DateTime? StartTime
        {
            get { return this._startTime; }
            set { this._startTime = value; }
        }
        /// <summary>
        /// EndTime
        /// </summary>
        public DateTime? EndTime
        {
            get { return this._endTime; }
            set { this._endTime = value; }
        }
        /// <summary>
        /// CarNo
        /// </summary>
        public string CarNo
        {
            get { return this._carNo; }
            set { this._carNo = value; }
        }
        /// <summary>
        /// DeviceNo
        /// </summary>
        public string DeviceNo
        {
            get { return this._deviceNo; }
            set { this._deviceNo = value; }
        }
        /// <summary>
        /// EvtPara
        /// </summary>
        public string EvtPara
        {
            get { return this._evtPara; }
            set { this._evtPara = value; }
        }
        /// <summary>
        /// EventType
        /// </summary>
        public string EventType
        {
            get { return this._eventType; }
            set { this._eventType = value; }
        }
        /// <summary>
        /// Mileage
        /// </summary>
        public decimal? Mileage
        {
            get { return this._mileage; }
            set { this._mileage = value; }
        }
        /// <summary>
        /// MiddleTime
        /// </summary>
        public DateTime? MiddleTime
        {
            get { return this._middleTime; }
            set { this._middleTime = value; }
        }
        
        /// <summary>
        /// 对比两个TP_EventHistory数据模型对象是否一致
        /// </summary>
        /// <param name="obj">要进行比对的TP_EventHistory数据模型对象</param>
        /// <returns>返回是否一致，为true一致，为false不一致</returns>
        public override bool Equals(object obj)
        {
            //判断传入对象是否为null
            if (obj == null) return false;
            //将传入对象转换成TP_EventHistory数据模型对象
            TP_EventHistoryMod tP_EventHistoryMod = obj as TP_EventHistoryMod;
            //判断是否转换成功
            if (tP_EventHistoryMod == null) return false;
            //进行匹配属性的值
            return
                //判断ID是否一致
                this.ID == tP_EventHistoryMod.ID &&
                //判断EventKey是否一致
                this.EventKey == tP_EventHistoryMod.EventKey &&
                //判断StartTime是否一致
                this.StartTime == tP_EventHistoryMod.StartTime &&
                //判断EndTime是否一致
                this.EndTime == tP_EventHistoryMod.EndTime &&
                //判断CarNo是否一致
                this.CarNo == tP_EventHistoryMod.CarNo &&
                //判断DeviceNo是否一致
                this.DeviceNo == tP_EventHistoryMod.DeviceNo &&
                //判断EvtPara是否一致
                this.EvtPara == tP_EventHistoryMod.EvtPara &&
                //判断EventType是否一致
                this.EventType == tP_EventHistoryMod.EventType &&
                //判断Mileage是否一致
                this.Mileage == tP_EventHistoryMod.Mileage &&
                //判断MiddleTime是否一致
                this.MiddleTime == tP_EventHistoryMod.MiddleTime;
        }
        /// <summary>
        /// 将当前TP_EventHistory数据模型对象转换成哈希码
        /// </summary>
        /// <returns>哈希值</returns>
        public override int GetHashCode()
        {
            //将TP_EventHistory数据模型对象的属性进行按位异或运算处理得到哈希码并返回
            return
                //将ID进行按位异或运算处理
                this.ID.GetHashCode() ^
                //将EventKey进行按位异或运算处理
                (this.EventKey == null ? 2147483647 : this.EventKey.GetHashCode()) ^
                //将StartTime进行按位异或运算处理
                (this.StartTime == null ? 2147483647 : this.StartTime.GetHashCode()) ^
                //将EndTime进行按位异或运算处理
                (this.EndTime == null ? 2147483647 : this.EndTime.GetHashCode()) ^
                //将CarNo进行按位异或运算处理
                (this.CarNo == null ? 2147483647 : this.CarNo.GetHashCode()) ^
                //将DeviceNo进行按位异或运算处理
                (this.DeviceNo == null ? 2147483647 : this.DeviceNo.GetHashCode()) ^
                //将EvtPara进行按位异或运算处理
                (this.EvtPara == null ? 2147483647 : this.EvtPara.GetHashCode()) ^
                //将EventType进行按位异或运算处理
                (this.EventType == null ? 2147483647 : this.EventType.GetHashCode()) ^
                //将Mileage进行按位异或运算处理
                (this.Mileage == null ? 2147483647 : this.Mileage.GetHashCode()) ^
                //将MiddleTime进行按位异或运算处理
                (this.MiddleTime == null ? 2147483647 : this.MiddleTime.GetHashCode());
        }
        /// <summary>
        /// 将当前TP_EventHistory数据模型对象转换成字符串副本【仅显示在SQL中不能为空的列】
        /// </summary>
        /// <returns>字符串形式副本</returns>
        public override string ToString()
        {
            //将当前TP_EventHistory数据模型对象转换成字符串副本
            return
                "[" +
                //将ID转换成字符串
                this.ID + "," +
                //将EventKey转换成字符串
                this.EventKey + "," +
                //将EventType转换成字符串
                this.EventType +
                "]";
        }
    }
}
